// 测试
var qklUrl = '';//测试服务器接口地址
var Url1 = ""//测试地址验证码
var domain = "" //
var indexUrl = '';//

//回登录页
function goHome(){
    window.location.href="../../login.html";
}
function goHome1(){
  window.location.href="fillpage.html";
}
//退出登录
function quitLogin(){
    delCookie('token');
    $.ajax({
        type: "get",
        url: qklUrl+"/sysDict/logout",
        async:false,  
        dataType: "json", //表示返回值类型，不必须
        success: function (result) {
            console.log(result);
        },
        error:function(){
            alert("请联系管理员");
        }
    })
    window.location.reload();
}
//存cookie
function setCookie(name, value) {
    if (value) {
      var Days = 365
      var exp = new Date()
      exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000)
      document.cookie = name + '=' + escape(value) + ';expires=' + exp.toGMTString()
    }
}
//取cookie
function getCookie(name){
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}
function GetCookieValue(name) {
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
   var cookies = document.cookie.split(';');
   for (var i = 0; i < cookies.length; i++) {
     var cookie = jQuery.trim(cookies[i]);
     if (cookie.substring(0, name.length + 1) == (name + '=')) {
   cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
   break;
     }
   }
    }
    return cookieValue;
}
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() + (-1 * 24 * 60 * 60 * 1000));
    var cval = GetCookieValue(name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//清除所有cookie
function clearCookie() {
    var keys = document.cookie.match(/[^ =;]+(?=\=)/g)
    if (keys) {
      for (var i = keys.length; i--;) {
        document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString()
      }
    }
}